<template>
  <div id="home">
    <nav-bar/>
    <swiper :data="result.banner.list"/>
    <recommend :data="result.recommend.list"/>
    <popular title="本周流行" :data="popular"/>
  </div>
</template>

<script>
  // import home from "../../assets/js/home";

  // 网络请求
  import multidata from "../../assets/net/multidata";

  import navBar from "../../components/normal/navbar/viewIndex";
  import swiper from "../../components/normal/swiper/index";
  import recommend from "../../components/normal/recommendIndex";
  import Popular from "../../components/home/popularIndex";

  export default {
    name: "Home",
    data() {
      return {
        result: null,
        popular: null
      }
    },
    components: {
      Popular,
      navBar,
      swiper,
      recommend
    },
    created() {
      // 网络请求数据
      // this.ajax.get(home.dataUrl).then((res) => {
      //   this.result = res.data
      // }).catch( err => {
      //   console.log(err)
      // })
      this.result = multidata.data
      this.popular = this.result.recommend.list.concat(this.result.recommend.list)
      console.log(this.popular)
    }
  };
</script>

<style scoped>
  #home {
    padding-top: 44px;
    padding-bottom: 50px;
  }
  #home .nav-bar {
    color: white;
    background-color: pink;
  }
</style>
